import { useAuth } from '@/hooks/useAuth';
import { Navigate } from 'umi';

const withAuth = (Component: any) => () => {
  const { isLogin } = useAuth();
  if (isLogin) {
    return <Component />;
  } else {
    return <Navigate to="/login" />;
  }
};

export default withAuth;
